package com.xkdx.guangguang.fragment.user;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;

import com.xkdx.guangguang.module.network.AbsAction;
import com.xkdx.guangguang.module.statics.IConstants;

public class UserRegistAction extends AbsAction {

	private Context context;
	private String loginID;

	public UserRegistAction(Context context, String loginID) {
		// url = IConstants.address + "userInterface/register.php";
		this.context = context;
		this.loginID = loginID;
		url = IConstants.addressV2;
	}

	@Override
	public void constructRequest() {
		// requestData = json;
		// 获取手机号
		TelephonyManager mTelephonyManager = (TelephonyManager) context
				.getSystemService(context.TELEPHONY_SERVICE);
		String MobilePhone = mTelephonyManager.getLine1Number();
		// 获取设备串号
		String deviceSN = mTelephonyManager.getDeviceId();
		// 获取设备型号
		String deviceModel = Build.MODEL;
		// 获取系统版本
		String oSVersion = Build.VERSION.SDK;
		HashMap<String, String> map = new HashMap<String, String>();

		map.put("DeviceID", "2");
		map.put("RegionID", "D0101");
		map.put("Password", "123456");
		map.put("LoginID", loginID);
		map.put("NickName", "");
		map.put("MobilePhone", MobilePhone);
		map.put("DeviceSN", deviceSN);
		map.put("DeviceModel", deviceModel);
		map.put("OSVersion", oSVersion);
		
		String registJson = constructJson(map);
		Parameter parameter = new Parameter("userInterface", "register",
				registJson);

		List<Parameter> list = new ArrayList<Parameter>();
		list.add(parameter);
		requestData = constructMod(list);
		
	}

}
